<section>
	<div class="page-header">
		<h2><?php echo $title; ?></h2>
	</div>
	
	<?php echo form_open('', array('autocomplete' => 'off')); ?>
		<div class="clearfix">
			<label>Name <span class="req">*</span></label>
			<div class="input">
				<input type="text" name="label_name" />
			</div>
		</div>
		<div class="clearfix">
			<label>Website <span class="req">*</span></label>
			<div class="input">
				<?php echo show_array_dropdown($websites, 'site_code', 'site_name', '', 'website'); ?>
			</div>
		</div>
		<div class="clearfix">
			<label>Category <span class="req">*</span></label>
			<div class="input">
				<select name="category" id="category"></select>
			</div>
		</div>
		<div class="clearfix">
			<label>Description</label>
			<div class="input">
				<textarea id="mainbody" name="description" class="xxlarge"></textarea>
			</div>
		</div>
		<div class="actions">
			<button type="submit" class="btn primary">Save</button>
			<?php echo anchor('contents/product_labels', 'Cancel', array('class' => 'btn')); ?>
		</div>
	</form>
</section>

<?php echo script_tag('public/js/tiny_mce/tiny_mce.js'); ?>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "exact",
		elements: 'mainbody',
		theme : "advanced",
		plugins : "table,inlinepopups,codeprotect",
		height: '200',
		width: "600",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,link,unlink,charmap",theme_advanced_buttons2 : '',
		theme_advanced_buttons3 : '',
		theme_advanced_buttons4 : '',
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		//theme_advanced_resizing : true,
		apply_source_formatting : false,

		// Example content CSS (should be your site CSS)
		content_css : "<?php echo site_url('public/css/content.css'); ?>"
	});
	
	$('form').submit(function() {
		if ($('textarea[name="content"]').is(':hidden'))
		{
			tinyMCE.get("mainbody").save();
		}
	});
	
	$('#website').change(function() {
		var typ = $(this);
		var val = $(this).val();
		
		showProductCat('<?php echo site_url('ajax/list_website_product_categories'); ?>/' + val, 'category');
	});
</script>

